package 数据结构下

object FoldDemo02 {
  def main(args: Array[String]): Unit = {
    val list = List(1, 9)

    def minus(n1: Int, n2: Int): Int = {
      n1 - n2
    }

    /*foldLeft的简写形式*/
    var i = (1 /: list) (minus)
    println(i)

    /*右折叠简写*/
    val i1 = (list :\ 10) (minus)
    println(i1)
  }
}
